/** \file    refine/topology_limit.h
  * \brief   Calculates possible limits on mask's value that will not change topology of objects.
  * \date    2003, 2004
  * \author  Fedor Chelnokov
  * \version $Header: /home/cscom1r4/cvsroot/cs/include/refine/topology_limit.h,v 1.2 2005/09/10 19:09:41 cscom1r4 Exp $
  */

#ifndef _refine_topology_limit_h_
#define _refine_topology_limit_h_

#include "types.h"

namespace refine {

namespace bit_mask {

	///What is most likely central pixel state?
	enum vsituation {
		any,	//any state is equally likely
		pbt,	//change of state is prohibited
		fo, to, //false (true) only
		fl, tl //false (true) is more likely than other
		//fll, tll //false (true) is much more likely
	};

	//if (minor) then the restrictions on the topology will be minimal
	vsituation topology_limit(const mask & m, int_point p, bool minor);

} //namespace bit_mask

namespace grey_mask {

	///returns possible range [min, max] of mask value at p;
	///if (max < min) then change of mask at this point is prohibited;
	///if (max == min) then only this value is acceptable to mask in the given point
	template <class M>
	void topology_limit(const M & m, int_point p, mask_value & min, mask_value & max);

} //namespace grey_mask

} //namespace refine

#endif _refine_topology_limit_h_
